import 'package:flutter/material.dart';

class WJCustomContainer extends StatelessWidget {
  final double? width;
  final double? height;
  final Color?  color;
  final double? borderRadius;
  final Gradient? gradient;
  final Color?  borderColor;
  final double? borderWidth;
  final EdgeInsetsGeometry? padding;
  final EdgeInsetsGeometry? margin;
  final AlignmentGeometry? alignment;
  final Widget? child;
  final Function? onTap;

  const WJCustomContainer({
    super.key,
    this.width,
    this.height,
    this.color,
    this.borderRadius,
    this.gradient,
    this.borderColor,
    this.borderWidth,
    this.padding,
    this.margin,
    this.child,
    this.onTap,
    this.alignment,
  });

  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return onTap != null ?
    GestureDetector(
      onTap: (){
        onTap?.call();
      },
      child:content(),
    ) : content();
  }

  Widget content() {
    return  Container(
      width: width,
      height: height,
      alignment: alignment ?? Alignment.center,
      padding: padding,
      margin: margin,
      decoration: BoxDecoration(
        color:color,
        borderRadius: borderRadius != null ? BorderRadius.circular(borderRadius!) : null,
        gradient: gradient,
        border: Border.all(
          color: borderColor ?? Colors.transparent,
          width: borderWidth ?? 0,
        ),
      ),
      child: child,
    );
  }
}